package com.ean.backpack.domain;

import java.io.Serializable;
import java.util.Calendar;

import javax.persistence.Column;
import javax.persistence.Embeddable;

import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.springframework.beans.factory.annotation.Configurable;

@Configurable
@Embeddable
public final class AliasregionlistPK implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1218948077816212424L;

	public AliasregionlistPK() {
		super();
	}

	@Column(name = "RegionID", nullable = false)
	private Integer regionId;

	@Column(name = "LanguageCode", nullable = false, length = 5)
	private String languageCode;

	@Column(name = "AliasString", nullable = false, length = 255)
	private String aliasString;

	@Column(name = "TimeStamp", nullable = false)
	private Calendar timeStamp;

	public AliasregionlistPK(Integer regionId, String languageCode,
			String aliasString, Calendar timeStamp) {
		super();
		this.regionId = regionId;
		this.languageCode = languageCode;
		this.aliasString = aliasString;
		this.timeStamp = timeStamp;
	}

	public Integer getRegionId() {
		return regionId;
	}

	public String getLanguageCode() {
		return languageCode;
	}

	public String getAliasString() {
		return aliasString;
	}

	public Calendar getTimeStamp() {
		return timeStamp;
	}

	@Override
	public String toString() {
		return ReflectionToStringBuilder.toString(this,
				ToStringStyle.SHORT_PREFIX_STYLE);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((aliasString == null) ? 0 : aliasString.hashCode());
		result = prime * result
				+ ((languageCode == null) ? 0 : languageCode.hashCode());
		result = prime * result
				+ ((regionId == null) ? 0 : regionId.hashCode());
		result = prime * result
				+ ((timeStamp == null) ? 0 : timeStamp.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		AliasregionlistPK other = (AliasregionlistPK) obj;
		if (aliasString == null) {
			if (other.aliasString != null)
				return false;
		} else if (!aliasString.equals(other.aliasString))
			return false;
		if (languageCode == null) {
			if (other.languageCode != null)
				return false;
		} else if (!languageCode.equals(other.languageCode))
			return false;
		if (regionId == null) {
			if (other.regionId != null)
				return false;
		} else if (!regionId.equals(other.regionId))
			return false;
		if (timeStamp == null) {
			if (other.timeStamp != null)
				return false;
		} else if (!timeStamp.equals(other.timeStamp))
			return false;
		return true;
	}

}
